/*
 * Copyright (c) 2009 Frederic Daoud
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
package org.stripesbook.rayures.action;

import net.sourceforge.stripes.action.ActionBean;
import net.sourceforge.stripes.action.Resolution;
import org.stripesbook.rayures.view.ViewContext;

/**
 * Interface that action beans must implement to take advantage of Rayures features. The easiest
 * thing to do is to simply extend {@link RayuresBaseActionBean}.
 *
 * @author Frederic Daoud
 */
public interface RayuresActionBean extends ActionBean {
  /** Getter for the current request's {@link ViewContext} object. */
  ViewContext getViewContext();

  /** Setter for the current request's {@link ViewContext} object. */
  void setViewContext(ViewContext viewContext);

  /**
   * Returns the path to which to forward to by default. This is used for event handlers that return
   * {@code void}, as in {@code public void view()}.
   */
  String getDefaultPath();

  /**
   * Returns the resolution to use, if any. This is used for event handlers that return {@code void}
   * and want to override the default of forwarding to {@link #getDefaultPath()}.
   */
  Resolution getResolution();

  /**
   * Sets the resolution to use, if any. This is used for event handlers that return {@code void}
   * and want to override the default of forwarding to {@link #getDefaultPath()}.
   */
  void setResolution(Resolution resolution);

  /**
   * Returns the object to be made available in the view template with the key
   * {@value org.stripesbook.rayures.util.Constants#ATTR_VIEW}.
   */
  Object getView();
}
